#include "test.h"
#include "main.h"

class Test_Demo : public Test
{
	public:
	
	Test_Demo() {}

	void check() {}
	void users()
	{
		bstream();
		tstream();
		linear();
	}

	void bench() {}
	

	protected:
	
	void bstream()
	{
		FileMappingDynamicSegment fmds("tmp/data.bin",true,0644	,1024*1024);
		BOStorage bos(fmds);
	
		bos << std::string("test");
		bos << BOStorage::BEGIN << 0x77 << BOStorage::END;
		bos << BOStorage::BEGIN;
		std::vector<Point2D> a;
		a.push_back(Point2D(2,3));
		a.push_back(Point2D(4,5));
		bos << a;
		bos << BOStorage::END;

	}


	void tstream()
	{
		FileMappingDynamicSegment fmds("tmp/data.txt",true,0644	,1024*1024);
		TOStorage tos(fmds);
	
		tos << TOStorage::DEC;
		tos << std::string("test") << TOStorage::NL;
		tos << "fixed";
		tos << TOStorage::BEGIN << 77 << TOStorage::END;
		tos << TOStorage::BEGIN;
		std::vector<Point2D> a;
		a.push_back(Point2D(2,3));
		a.push_back(Point2D(4,5));
		tos << a;
		tos << TOStorage::END;
		tos << TOStorage::POP;

	}


	void linear()
	{
		
	}




};

REGTEST(Test_Demo);
